UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gv1ZcQYNkzGkztAk3y6DU61GuvM4Oe/oqytqoZg5XX8='
WHERE
key_id = 'a26f08bbdc5991f5128116258b74b798241f9208a505305c9c2efa92b50f90b7'
AND (
token = 'gv1ZcQYNkzGkztAk3y6DU61GuvM4Oe/oqytqoZg5XX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)