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