UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zv+vwM8C4PgRjFm0SNIZT76gkTX3mXga4iX4o2PaBy0='
WHERE
key_id = 'f660b161cbb769313b5b9ab2deb7c2490feeb6e77a3729bf3ed546853af4b64e'
AND (
token = 'zv+vwM8C4PgRjFm0SNIZT76gkTX3mXga4iX4o2PaBy0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)