UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fhyM4DZYBnJWk2146BWAUAhazWcBTpWxRGLY82LBAMo='
WHERE
key_id = '794d6fa52aaea8bb49b0f54e6bfd555165e1283f9367230f16c048a31f8da8f1'
AND (
token = 'fhyM4DZYBnJWk2146BWAUAhazWcBTpWxRGLY82LBAMo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)