UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5q6NJF1utjrq3V4awz8mqoi7uCOp8xQq+oD69lWOlZM='
WHERE
key_id = 'bec7c09e8526d77042111dfe4badb20c1b79065a6059f15ba5f3cb52f43a46ec'
AND (
token = '5q6NJF1utjrq3V4awz8mqoi7uCOp8xQq+oD69lWOlZM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)