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