UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dmtK/uoGDCeWbiAxJW69GJbiMSp10uX9buIpZ/0cn3k='
WHERE
key_id = 'ba099c6113d35c21b7526792478fee051122a362ebc643e9a9c8087aab760392'
AND (
token = 'dmtK/uoGDCeWbiAxJW69GJbiMSp10uX9buIpZ/0cn3k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)