UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '58EHPnhQG+bgaWQ1RDo1vKivaz0f03G5mec9JcFr+WE=' 
WHERE 
  key_id = 'a8a46e30eaf463cdb3a9f881568b6c88b99264202233768fc8ee211bbbdcb2d7' 
  AND (
    token = '58EHPnhQG+bgaWQ1RDo1vKivaz0f03G5mec9JcFr+WE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037