UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jx4vgXMe1FF5/Z00G4exAuX8OehEnCHlRC5WctPR5Uw='
WHERE
key_id = 'd67769196bc164987548c05e14ac984acf5dbc05b6cf8be0c9cc37e6019a0f5b'
AND (
token = 'Jx4vgXMe1FF5/Z00G4exAuX8OehEnCHlRC5WctPR5Uw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)