UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y/bEutM2DyD01ARZoCaYEC8DvyDpS8O9lvBiX46zOvo='
WHERE
key_id = '5e21e8a2947c48c7865f035b7a73d163d6eed17490b5b80a5fac0488fbe32089'
AND (
token = 'y/bEutM2DyD01ARZoCaYEC8DvyDpS8O9lvBiX46zOvo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)