UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T8wNExMEMivVI5JmZX1AsK3G2kAihGaYnl/47zHVVjY='
WHERE
key_id = 'a5316dbef1272cd8fdec3220ab9d80a4ecb5b069953b177043c506a0d50c4e7a'
AND (
token = 'T8wNExMEMivVI5JmZX1AsK3G2kAihGaYnl/47zHVVjY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)