UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bQOsM1QhX5lpiYmvoUjxGbPIteriVl20uUD+1QaOH44='
WHERE
key_id = '344171a7e0e4649f6cd7c3223096169854a9cdb5fd878ebd5a63ed84a439060a'
AND (
token = 'bQOsM1QhX5lpiYmvoUjxGbPIteriVl20uUD+1QaOH44='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)