UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UejyX+ImOSvz6SPUV+bjfEXZ5XbgO+m9ewie/XOu+4Y=' 
WHERE 
  key_id = 'b446813e7d2b4d2a97d251f959591d050acf76074e486fcc5841f8fd582304b2' 
  AND (
    token = 'UejyX+ImOSvz6SPUV+bjfEXZ5XbgO+m9ewie/XOu+4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035