UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U+xlXAi/3g81wcUCJGyzm2X55klv6/cjyNlGK8uw9bU=' 
WHERE 
  key_id = 'bec722b5764c25884d1fe482f1c500032c3297209dba1250652ccafd155a3d1f' 
  AND (
    token = 'U+xlXAi/3g81wcUCJGyzm2X55klv6/cjyNlGK8uw9bU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020