UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QX7XG7UqWZyoqNbmQ7PANQwlxxmuoAN6eih23/918G4='
WHERE
key_id = 'd50e54c49832e7c9943bedf1f4b0ecae7e94e88caca41fc254c9006ea1307d8f'
AND (
token = 'QX7XG7UqWZyoqNbmQ7PANQwlxxmuoAN6eih23/918G4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)