UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AFEb+p5WaLzBY6eUanYlLDRqI47ZetxzqkPsNnMRY+M='
WHERE
key_id = '9acc1dea6d133012cf5729e639079f2f1731bd3a0f405688dcad642ba13675ab'
AND (
token = 'AFEb+p5WaLzBY6eUanYlLDRqI47ZetxzqkPsNnMRY+M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)