UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U7thsVQmCxISidx0z4M9iwxwctNv39LySAuFCLZe8SE=' 
WHERE 
  key_id = '064882b580368fd0c7fa6ba052dbb9223b51d986852233c95ebf3585a5153b40' 
  AND (
    token = 'U7thsVQmCxISidx0z4M9iwxwctNv39LySAuFCLZe8SE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037