UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '61qHMzrRYEQ8nMggfHOp0HDN9rqtxwSZ1ZuNHnLHv+o=' 
WHERE 
  key_id = '17c210816752883d5cdb881de2ea403c71ba60e6e7977a6d3502e7cc47228560' 
  AND (
    token = '61qHMzrRYEQ8nMggfHOp0HDN9rqtxwSZ1ZuNHnLHv+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041