UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ait6WsSdYQ8iWGW4RJ0lJ5PCCXkny/Zya20sn597f0w='
WHERE
key_id = 'd07a0edd4e6a14de6baa1cc86df1c3f24347756846d33c046698ee7aa1700c50'
AND (
token = 'Ait6WsSdYQ8iWGW4RJ0lJ5PCCXkny/Zya20sn597f0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)