UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/3JoeCPkivyaGcU09u5e7TpVxmbut2ymHVQVtIXN6Uk='
WHERE
key_id = 'cbd888a8129eba82a9f5bd2de195fc3f73ddb079f21a3054aef440f632f9ba2b'
AND (
token = '/3JoeCPkivyaGcU09u5e7TpVxmbut2ymHVQVtIXN6Uk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)