UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UlXR5nqADu5mraWMpCvpF9S6quVoaUTJduTFOu8Iqzo='
WHERE
key_id = 'cca466796a479b182b5f2827637a569690d456b2396f75c2a76fc1dbc6e9d1f7'
AND (
token = 'UlXR5nqADu5mraWMpCvpF9S6quVoaUTJduTFOu8Iqzo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)