UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qyYjHVqhgSb1bQOX0Xg9L0JSPWJx53nq//ewOH5Hlfs=' 
WHERE 
  key_id = 'e78f8c9aea9e21af2df5cd10d0b9e46babd790b66f817ebdab53234698869c32' 
  AND (
    token = 'qyYjHVqhgSb1bQOX0Xg9L0JSPWJx53nq//ewOH5Hlfs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061