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