UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mJGCBOYZ5ioOFEL5cdZLmGR1hqXNu2OwrVrtxyaenRU=' 
WHERE 
  key_id = '9f4031529f4294c94ee4991df197ead3b6289888c4b49517f0e5290edfdd45f9' 
  AND (
    token = 'mJGCBOYZ5ioOFEL5cdZLmGR1hqXNu2OwrVrtxyaenRU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035