UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J9UJfLk/u255vuFUiqmcVFpv8OPjapQ3Xt1P5gEROj8='
WHERE
key_id = '187b7b3668a90700974cf4dfe4f8492736d2d464d014a801564eb1e6018d5adb'
AND (
token = 'J9UJfLk/u255vuFUiqmcVFpv8OPjapQ3Xt1P5gEROj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)