UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IGQ/+jCCImmTRcCj+wsvfcs6VLtCF1JGHRfnuieluUc='
WHERE
key_id = 'e5617e80fa295a1c55cba600e27f2b87bb3d8beecc566e13bb26dcc4274ed231'
AND (
token = 'IGQ/+jCCImmTRcCj+wsvfcs6VLtCF1JGHRfnuieluUc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)