UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c9TFGp2BigUn3rCBfBVJUxh6rWo8saOBcpHcQ0fE8UA='
WHERE
key_id = 'f7c6b0ad9ed221f23987ffd92bdda4102859790e4349289ed4f75c5c6f0147bc'
AND (
token = 'c9TFGp2BigUn3rCBfBVJUxh6rWo8saOBcpHcQ0fE8UA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)