UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1G7hwXn9n1QirVBSu0u8VPcHSWftwExjevUHZh18ju8='
WHERE
key_id = '4c511074431ef72ab7e96512834f4a2805486aa56376b751c01a6a98a42945be'
AND (
token = '1G7hwXn9n1QirVBSu0u8VPcHSWftwExjevUHZh18ju8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)