UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BpYN++TaHvCScsME5JHmdKLUIPC2lMG837ILFYQSqpM='
WHERE
key_id = 'e66a8a472e33a82129be968e0a9b45c5a62e3b2c42e661aa5027cde84b706f2d'
AND (
token = 'BpYN++TaHvCScsME5JHmdKLUIPC2lMG837ILFYQSqpM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)