UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8aGturArUHm6Nk5m0NvJGV97tdgrCHEVtJC8l4xohHY='
WHERE
key_id = '39c361789cc846d892a6eaee3b2101fc814c7ded58ba9729fa2da16950c2cf4c'
AND (
token = '8aGturArUHm6Nk5m0NvJGV97tdgrCHEVtJC8l4xohHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)