UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jam0j8FAu6Tlg+501soOX1M7qUOtV3b83ileQc5rSac=' 
WHERE 
  key_id = '93cf16447b6d250c3f7bc1276cb709219502920773c435d71e470e581994806f' 
  AND (
    token = 'Jam0j8FAu6Tlg+501soOX1M7qUOtV3b83ileQc5rSac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039