UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7qzyUTXDb04IA8IR9TQCmZgfCA8H3XbKQOtnDzXVHU8='
WHERE
key_id = 'c8a5d3cf1080bb0202db49a935b512cf88ca8f5da29c3405b244a0ee7a22b7a6'
AND (
token = '7qzyUTXDb04IA8IR9TQCmZgfCA8H3XbKQOtnDzXVHU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)