UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6NvVAe7ReKXtOlDsi49JgHgytDTKcBPv9eU++GcYWOc='
WHERE
key_id = 'd27049babf62b1eeb0738611800f8159fad6205c897bd875f470823def431f08'
AND (
token = '6NvVAe7ReKXtOlDsi49JgHgytDTKcBPv9eU++GcYWOc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)