UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q0Vn515PefiN+uUXFdGAAmX6ExUUv/KxEyxBGghhHLs='
WHERE
key_id = 'dd13352dff3eddf0685c71e34e31610033af8e0e8a294cb04b46398ad0230966'
AND (
token = 'Q0Vn515PefiN+uUXFdGAAmX6ExUUv/KxEyxBGghhHLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)