UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NZE/IAUBbUTtbgrLywclQdcWFf2ZwuXoOm+34FTvoXI='
WHERE
key_id = 'aed42c29e98442a5ba4ffcc912dac55410e981aff3bfe4276ede0ee855d26954'
AND (
token = 'NZE/IAUBbUTtbgrLywclQdcWFf2ZwuXoOm+34FTvoXI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)