UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S7Kf92GdGSKGt8NR5VyBevLGqIIGfGWagQx3jG4FCk8='
WHERE
key_id = '85b1fc1360123d15040deec81bac2d03a1d9b9e34e4af38a163a847ed3f56bd6'
AND (
token = 'S7Kf92GdGSKGt8NR5VyBevLGqIIGfGWagQx3jG4FCk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)